Foreshore Solutions Image Functions Library



Table of Contents

Foreshore Solutions Image Functions Library
Notes
Error codes
Function List
Image creation and destruction
Image properties
Image utilities
Maths operations
Transforms
Inspection Functions
Search training functions
Search usage functions
Blob functions
Helper functions
Utility functions

Notes

Image consist of a structure with a pointer to a buffer containing the pixel data.
Colour images normally have the planes interleaved in the order BGR to speed up display.
For most functions if the destination image is ** then if the destination pointer is null a new image will be created

Error codes

OK

0

Image dimensions are incorrect

1

One or more parameters are incorrect

2

Other error

3

Memory access error

99

Activation error

100



Function List

Image creation and destruction

FS_AllocateImage

VC long _stdcall FS_AllocateImage(colour_image* src, long lImageWidth, long lImageHeight, long lImageDepth);
VB Public Declare Function FS_AllocateImage Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lImageWidth As Long, ByVal lImageHeight As Long, ByVal lImageDepth As Long) As Long
Allocates image buffer of the specified width, height and depth, and updates the image properties appropriately
If the image already has a buffer allocated, this will be deleted first



FS_CreateCopyImage

VC long _stdcall FS_CreateCopyImage(colour_image* src, colour_image** dest);
VB Public Declare Function FS_CreateCopyImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long) As Long
Creates a duplicate of an image including the memory
If an existing destination image is passed in, it will be deleted first
The increments may not be the same as the original.



FS_CreateEmptyImage

VC long _stdcall FS_CreateEmptyImage(colour_image** img);
VB Public Declare Function FS_CreateEmptyImage Lib "ImageFunctions.dll" (ByRef src As Long) As Long
Creates image structure, but does not allocate memory to hold the pixel data
If an existing image is passed in, it will be deleted first



FS_CreateImage

VC long _stdcall FS_CreateImage(colour_image** img, long lImageWidth, long lImageHeight, long lImageDepth);
VB Public Declare Function FS_CreateImage Lib "ImageFunctions.dll" (ByRef src As Long, ByVal lImageWidth As Long, ByVal lImageHeight As Long, ByVal lImageDepth As Long) As Long
Creates and allocates an image of the specified width, height and depth



FS_CreateMapImage

VC long _stdcall FS_CreateMapImage(colour_image* src, colour_image* *destimg, long lLeft, long lTop, long lRight, long lBottom);
VB Public Declare Function FS_CreateMapImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long) As Long
Creates an image using the same buffer as the source image.
When this image is deleted the buffer will not be deleted



FS_DeAllocateImage

VC long _stdcall FS_DeAllocateImage(colour_image* src);
VB Public Declare Function FS_DeAllocateImage Lib "ImageFunctions.dll" (ByVal src As Long) As Long
Clears the memory associated with the image.
If this is a map image then the memory will not be cleared as it is owned by another image



FS_DeleteImage

VC long _stdcall FS_DeleteImage(colour_image** src);
VB Public Declare Function FS_DeleteImage Lib "ImageFunctions.dll" (ByRef src As Long) As Long
Clears the memory associated with the image and deletes the image structure. The pointer will be set to zero



FS_GetPlaneImage

VC long _stdcall FS_GetPlaneImage(colour_image* src, colour_image** destimg, long lPlane);
VB Public Declare Function FS_GetPlaneImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lPlane As Long) As Long
Creates an image based around an existing colour plane
When this image is deleted the buffer will not be deleted



FS_IsAllocated

VC long _stdcall FS_IsAllocated(colour_image* src);
VB Public Declare Function FS_IsAllocated Lib "ImageFunctions.dll" (ByVal src As Long) As Long
Is there any memory allocated to this image. Returns 0 or 1 with no error codes.



FS_IsFSImage

VC bool _stdcall FS_IsFSImage(colour_image* img);
VB Public Declare Function FS_ IsFSImage Lib "ImageFunctions.dll" (ByVal img As Long) As Boolean
Is the pointer an image.



FS_WrapImage

VC long _stdcall FS_WrapImage(colour_image** img, long lImageData, long lSize, long lImageWidth, long lImageHeight, long lImageDepth, long lXInc, long lYInc, long lZInc);
VB Public Declare Function FS_WrapImage Lib "ImageFunctions.dll" (ByRef src As Long, ByVal lImageData As Long, ByVal lImageSize As Long, ByVal lImageWidth As Long, ByVal lImageHeight As Long, ByVal lImageDepth As Long, ByVal lXInc As Long, ByVal lYInc As Long, ByVal lZInc As Long) As Long
Creates an image based around an existing buffer
When this image is deleted the buffer will not be deleted



Image properties

FS_FlipBGR

VC long _stdcall FS_FlipBGR(colour_image* src);
VB Public Declare Function FS_FlipBGR Lib "ImageFunctions.dll" (ByVal src As Long) As Long
Adjust the pointer and ZInc to reflect the fact that the data is flipped. Also sets a flag so that the image can be safely deleted



FS_GetImagePixel

VC long _stdcall FS_GetImagePixel (colour_image* src, long lX, long lY);
VB Public Declare Function FS_GetImagePixel Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lX As Long, ByVal lY As Long) As Long
Returns the appropriate pixel value. Colour pixels are in byte order RGB. Errors are represented by negative values.



FS_SetImagePixel

VC long _stdcall FS_SetImagePixel (colour_image* src, long lX, long lY, long lValue);
VB Public Declare Function FS_SetImagePixel Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lX As Long, ByVal lY As Long, ByVal lValue As Long) As Long
Sets the appropriate pixel value. Colour pixels are in byte order RGB.



FS_SetImageArea

VC long _stdcall FS_SetImageArea (colour_image* src, long lLeft, long lTop, long lRight, long lBottom, long lValue);
VB Public Declare Function FS_SetImageArea Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lValue As Long) As Long
Sets area to the appropriate pixel value. Colour pixels are in byte order RGB.



FS_GetImageProperties

VC long _stdcall FS_GetImageProperties(colour_image* src, long* lImageData, long* lSize, long* lImageWidth, long* lImageHeight, long* lImageDepth, long* lXInc, long* lYInc, long* lZInc);
VB Public Declare Function FS_GetImageProperties Lib "ImageFunctions.dll" (ByVal src As Long, ByRef lImageData As Long, ByRef lImageSize As Long, ByRef lImageWidth As Long, ByRef lImageHeight As Long, ByRef lImageDepth As Long, ByRef lXInc As Long, ByRef lYInc As Long, ByRef lZInc As Long) As Long
Gets all the properties of an image in one go



FS_ GetPlaneImage

VC 'long _stdcall GetPlaneImage(colour_image* src, colour_image* *destimg, long lPlane);
Public Declare Function FS_GetPlaneImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lPlane As Long) As Long
Creates an image of a single plane using the same memory as the source image.



FS_ImageDepth

VC long _stdcall FS_ImageDepth(colour_image* src);
VB Public Declare Function FS_ImageDepth Lib "ImageFunctions.dll" (ByVal src As Long) As Long
Returns the images depth. Errors are represented by negative values



FS_ImageHeight

VC long _stdcall FS_ImageHeight(colour_image* src);
VB Public Declare Function FS_ImageHeight Lib "ImageFunctions.dll" (ByVal src As Long) As Long
Returns the images height. Errors are represented by negative values



FS_ImageWidth

VC long _stdcall FS_ImageWidth(colour_image* src);
VB Public Declare Function FS_ImageWidth Lib "ImageFunctions.dll" (ByVal src As Long) As Long
Returns the images width. Errors are represented by negative values



Image utilities

FS_ColourToMono

VB Public Declare Function FS_ColourToMono Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long) As Long
VC long _stdcall FS_ColourToMono(colour_image* src, colour_image** dest);
Converts a colour image to a mono one, with optional colour balancing



FS_CopyArea

VB Public Declare Function FS_CopyArea Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lTargetX As Long, ByVal lTargetY As Long) As Long
VC long _stdcall FS_CopyArea(colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom, long lTargetX, long lTargetY);
Copies an area of a source image to a target image



FS_CopyColourImage

VB Public Declare Function FS_CopyColourImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal Reflect As Boolean, ByVal Invert As Boolean, ByVal Rotate As Boolean) As Long
VC long _stdcall FS_CopyColourImage(colour_image* src, colour_image** dest, bool bReflect, bool bInvert, bool bRotate);
Copies an entire image with the option to rotate reflect etc.



FS_MonoToColour

VB Public Declare Function FS_MonoToColour Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long) As Long
VC long _stdcall FS_MonoToColour(colour_image* src, colour_image** dest);
Converts a mono image to a colour one





Maths operations

FS_AddImage

VC long _stdcall FS_AddImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_AddImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Adds two images together
Does not wrap round so adding 254 to 9 gives 255



FS_AddValue

VC long _stdcall FS_AddValue(colour_image* src, colour_image** dest, long lValue);
VB Public Declare Function FS_AddValue Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lValue As Long) As Long
Add a value to an image
Use a negative value to subtract
Does not wrap round so subracting 128 from 97 gives 0 and adding 254 to 9 gives 255



FS_AndImage

VC long _stdcall FS_AndImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_AndImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Ands two images together
Writes to a destination image in which each pixel is the logical AND of the two equivalent source pixels



FS_Binarise

VC long _stdcall FS_Binarise(colour_image* src, colour_image** dest, long lLowerThreshold, long lUpperThreshold);
VB Public Declare Function FS_Binarise Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLowerThreshold As Long, ByVal lUpperThreshold As Long) As Long
Binarises an image, with the values between and including the thresholds being 255 and others 0



FS_DifferenceImage

VC long _stdcall FS_DifferenceImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_DifferenceImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Finds the difference image of two images



FS_MaxImage

VC long _stdcall FS_MaxImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_MaxImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Writes to a destination in which each pixel is the maximum of the two equivalent source pixels



FS_MeanImage

VC long _stdcall FS_MeanImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_MeanImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Writes to a destination image in which each pixel is the mean of the two equivalent source pixels



FS_MinImage

VC long _stdcall FS_MinImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_MinImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Writes to a destination image in which each pixel is the minimum of the two equivalent source pixels



FS_MultiplyValue

VC long _stdcall FS_MultiplyValue(colour_image* src, colour_image** dest, long lValue);
VB Public Declare Function FS_MultiplyValue Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lValue As Long) As Long
Writes to a destination image in which each source pixel has been multiplied by a value



FS_NegateImage

VC long _stdcall FS_NegateImage(colour_image* src, colour_image** dest);
VB Public Declare Function FS_NegateImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long) As Long
Negates an image



FS_OrImage

VC long _stdcall FS_OrImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_OrImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Writes to a destination image in which each pixel is the logical OR of the two equivalent source pixels



FS_PixelMap

VC long _stdcall (colour_image* src, colour_image** dest, unsigned char *ucMap);
VB Public Declare Function FS_PixelMap Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByRef bMap As Byte) As Long
VB The call require a declaration of unsigned char ucMap[256], and ucMapis passed to the function
VB The call require a declaration of Map(256) as byte, and Map(0) is passed to the function
Applies a pixel map to an existing image.
The map is an array of 256 unsigned chars



FS_SmartBinarise

VC long _stdcall FS_SmartBinarise(colour_image* src, colour_image** dest, long lL, long lT, long lR, long lB, long lXFilterSize, long lYFilterSize, long lMinContrast, long lMinThreshold, long lMaxThreshold);
VB Public Declare Function FS_SmartBinarise Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lXFilterSize As Long, ByVal lYFilterSize As Long, ByVal lMinContrast As Long, ByVal lMinThreshold As Long, ByVal lMaxThreshold As Long) As Long
Binarises an image based on local threshold
lXFilterSize and lYFilterSize define the block size
lMinContrast is the contrast required for a block not to be defined as uniform in colour
lMinThreshold and lMaxThreshold are values below and above which the pixel is light or dark regardless of an local threshold



FS_SobelAngle

VC long _stdcall FS_SobelAngle (colour_image* src, colour_image** pdest, long lLeft, long lTop, long lRight, long lBottom, long lThreshold);
VB Public Declare Function FS_SobelAngle Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lThreshold As Long) As Long
Performs a Sobel angle filter



FS_SobelEmboss

VC long _stdcall FS_SobelEmboss (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom);
VB Public Declare Function FS_SobelEmboss Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long) As Long
Performs a Sobel emboss filter



FS_SobelFilter

VC long _stdcall FS_SobelFilter (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom);
VB Public Declare Function FS_SobelFilter Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long) As Long
Performs a Sobel magnitude filter



FS_SobelToMono

VC long _stdcall FS_SobelToMono (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom);
VB Public Declare Function FS_ SobelToMono Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long) As Long
Performs a Sobel magnitude filter with a mono result image where the maximum value in each plane is used



FS_SubtractImage

VC long _stdcall FS_SubtractImage(colour_image* src1, colour_image* src2, colour_image** dest);
VB Public Declare Function FS_SubtractImage Lib "ImageFunctions.dll" (ByVal Src1 As Long, ByVal Src2 As Long, ByRef Dest As Long) As Long
Subtracts the second image from the first
Does not wrap round so subracting 128 from 97 gives 0





Transforms

FS_BayerToColourHalf

VC long _stdcall FS_BayerToColourHalf (colour_image* src, colour_image** pdest, long lOrientation)
VB Public Declare Function FS_BayerToColourHalf Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lOrientation As Long) As Long
Transforms a monochrome masked image to a half resolution colour image



FS_BayerToColourFull

VC long _stdcall FS_BayerToColourFull (colour_image* src, colour_image** pdest, long lOrientation)
VB Public Declare Function FS_BayerToColourFull Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lOrientation As Long) As Long
Transforms a monochrome masked image to a full resolution colour image



FS_BayerToMono

VC long _stdcall FS_BayerToMono (colour_image* src, colour_image** pdest, long lOrientation)
VB Public Declare Function FS_BayerToMono Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lOrientation As Long) As Long
Transforms a monochrome masked image to a monochrome image



FS_HoughTransform

VC long _stdcall HoughTransform (colour_image* src, colour_image* dest, long lLeft, long lTop, long lRight, long lBottom, long lSobelThreshold, long lMinAngle, long lMaxAngle)
Public Declare Function FS_ HoughTransform Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lSobelThreshold As Long, ByVal lMinAngle As Long, ByVal lMaxAngle As Long) As Long
Perform a hough transform



FS_HoughEnhancedTransform

VC long _stdcall FS_HoughEnhancedTransform (colour_image* src, colour_image* dest, long lLeft, long lTop, long lRight, long lBottom, long lSobelThreshold, long lMinAngle, long lMaxAngle)
VB Public Declare Function FS_HoughEnhancedTransform Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lSobelThreshold As Long, ByVal lMinAngle As Long, ByVal lMaxAngle As Long) As Long
Perform an enhanced hough transform



FS_PolarUnwrap

VC long _stdcall FS_PolarUnwrap (colour_image* src, colour_image** dest, long lCentreX, long lCentreY, long lInnerRadius, long lOuterRadius, long lStartAngle, long lEndAngle);
VB Public Declare Function FS_PolarUnwrap Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lCentreX As Long, ByVal lCentreY As Long, ByVal lInnerRadius As Long, ByVal lOuterRadius As Long, ByVal lStartAngle As Long, ByVal lEndAngle As Long) As Long
Performs a polar unwrap



FS_ProjectH

VC long _stdcall FS_ProjectH (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom);
VB Public Declare Function FS_ProjectH Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long) As Long
Performs a horizontal projection



FS_ProjectV

VC long _stdcall FS_ProjectV (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom);
VB Public Declare Function FS_ProjectV Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long) As Long
Performs a vertical projection



FS_RotateImage

VC long _stdcall FS_RotateImage (colour_image* src, colour_image** dest, long lCentreX, long lCentreY, double dAngle);
VB Public Declare Function FS_RotateImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lCentreX As Long, ByVal lCentreY As Long, ByVal Angle As Double) As Long
Fills a destination image from a rotated source image blanking pixels that fall outside the source image.
The angle is in degrees.



FS_RotateImageSmoothed

VC long _stdcall RotateImageSmoothed (colour_image* src, colour_image* dest, long lCentreX, long lCentreY, double dAngle)
VB long _stdcall FS_RotateImageSmoothed (colour_image* src, colour_image** dest, long lCentreX, long lCentreY, double dAngle);
Fills a destination image from a rotated source image blanking pixels that fall outside the source image.
The angle is in degrees.



FS_SelectColour

VC long _stdcall FS_SelectColour (colour_image* src, colour_image** pdest, long lRed, long lGreen, long lBlue, double dColourTolerance, long lBrightnessTolerance);
VB Public Declare Function FS_SelectColour Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lRed As Long, ByVal lGreen As Long, ByVal lBlue As Long, ByVal lColourTolerance As Double, ByVal lBrightnessTolerance As Long) As Long
Create a mono image based on the selected colour and tolerance
Brightness tolerance is in grey levels, colour tolerance is in degrees



FS_ShrinkImage

VC long _stdcall FS_ShrinkImage (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom, long lGranularity);
VB Public Declare Function FS_ShrinkImage Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lGranularity As Long) As Long
Creates a reduced size image by sub-sampling. Granularity is the pixel step



FS_ShrinkMax

VC long _stdcall FS_ShrinkMax (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom, long lGranularity);
VB Public Declare Function FS_ShrinkMax Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lGranularity As Long) As Long
Creates a reduced size image by sub-sampling taking the maximum value of each quadlet. Granularity is the pixel step



FS_ShrinkMin

VC long _stdcall FS_ShrinkMin (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom, long lGranularity);
VB Public Declare Function FS_ShrinkMin Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lGranularity As Long) As Long
Creates a reduced size image by sub-sampling taking the minimum value of each quadlet. Granularity is the pixel step



FS_ShrinkImageSmoothed

VC long _stdcall FS_ShrinkImageSmoothed (colour_image* src, colour_image** dest, long lLeft, long lTop, long lRight, long lBottom, long lGranularity);
VB Public Declare Function FS_ShrinkImageSmoothed Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lGranularity As Long) As Long
Creates a reduced size image by averaging taking the average value of each quadlet. Granularity is the pixel step.





Inspection Functions

VC The histogram functions require a declaration of long HGram[256], with HGram being passed to the function
VB The histogram functions require a declaration of HGram(256) as long, and HGram(0) is passed to the function



FS_FindAngle

VC long _stdcall FS_FindAngle (colour_image* src, colour_image** pdest, long lLeft, long lTop, long lRight, long lBottom, long *plAngle, long lSobelThreshold, long lMinAngle, long lMaxAngle);
VB Public Declare Function FS_FindAngle Lib "ImageFunctions.dll" (ByVal src As Long, ByRef Dest As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByRef lAngle As Long, ByVal lSobelThreshold As Long, ByVal lMinAngle As Long, ByVal lMaxAngle As Long) As Long
Find the dominant angle in an ROI. Return an image showing the rotated projection.



FS_FindEdge

VC long _stdcall FS_FindEdge (colour_image* src, long lRow, long lStart, long lEnd, long lMinContrast, long lFilterWidth, long *plResult, long *plContrast);
VB Public Declare Function FS_FindEdge Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lRow As Long, ByVal lStart As Long, ByVal lEnd As Long, ByVal lMinContrast As Long, ByVal lFilterWidth As Long, ByRef plResult As Long, ByRef plContrast As Long) As Long
Find the first edge in a projection or image



FS_HistogramEllipse

VC long _stdcall FS_HistogramEllipse(colour_image* src, long lLeft, long lTop, long lRight, long lBottom, long *Hgram);
VB Public Declare Function FS_HistogramEllipse Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByRef HGram As Long) As Integer
Histograms an elliptical area of an image.



FS_HistogramInfo

VC long _stdcall FS_HistogramInfo(long *HGram, long lLeftTailPercentage, long lRightTailPercentage, long *lLeftTail, long *lRightTail, long *lMean, long *lMedian, long *lEnergy, long *lPixels);
VB Public Declare Function FS_HistogramInfo Lib "ImageFunctions.dll" (ByRef HGram As Long, ByVal lLeftTailPercentage As Long, ByVal lRightTailPercentage As Long, ByRef lLeftTail As Long, ByRef lRightTail As Long, ByRef lMean As Long, ByRef lMedian As Long, ByRef lEnergy As Long) As Long
Extracts three percentiles, the mean and "energy" from a histogram



FS_HistogramInfoEllipse

VC long _stdcall FS_HistogramInfoEllipse(colour_image* src, long lLeft, long lTop, long lRight, long lBottom, long lLeftTailPercentage, long lRightTailPercentage, long *lLeftTail, long *lRightTail, long *lMean, long *lMedian, long *lEnergy);
VB Public Declare Function FS_HistogramInfoEllipse Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lLeftTailPercentage As Long, ByVal lRightTailPercentage As Long, ByRef lLeftTail As Long, ByRef lRightTail As Long, ByRef lMean As Long, ByRef lMedian As Long, ByRef lEnergy As Long) As Integer
Histograms an elliptical area of an image, and returns three percentiles, the mean and "energy".



FS_HistogramInfoROI

VC long _stdcall FS_HistogramInfoROI(colour_image* src, long lLeft, long lTop, long lRight, long lBottom, long lLeftTailPercentage, long lRightTailPercentage, long *lLeftTail, long *lRightTail, long *lMean, long *lMedian, long *lEnergy);
VB Public Declare Function FS_HistogramInfoROI Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lLeftTailPercentage As Long, ByVal lRightTailPercentage As Long, ByRef lLeftTail As Long, ByRef lRightTail As Long, ByRef lMean As Long, ByRef lMedian As Long, ByRef lEnergy As Long) As Long
Histograms an area of an image, and returns three percentiles, the mean and "energy".



FS_HistogramROI

VC long _stdcall FS_HistogramROI(colour_image* src, long lLeft, long lTop, long lRight, long lBottom, long *Hgram);
VB Public Declare Function FS_HistogramROI Lib "ImageFunctions.dll" (ByVal src As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByRef HGram As Long) As Long
Histograms an area of an image.



Search training functions

FS_OSSearchTrain

VC long _stdcall FS_OSSearchTrain (colour_image *src, long lPlane, long* pTrainedModel, long lLeft, long lTop, long lRight, long lBottom);
VB Public Declare Function FS_OSSearchTrain Lib "ImageFunctionsOptimisedSearch" (ByVal src As Long, ByVal lPlane As Long, ByRef pModel As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lQuality As Long) As Long
Basic training function biased towards speed
src is a pointer to an image
lPlane is the 0 based colour plane to use (0 for monochrome images)
pTrainedModel is a pointer to the resulting model, which need to be deleted by using FS_OSDeleteModel
lLeft etc define the region to be trained



FS_OSSearchTrainAllAngles

VC long _stdcall FS_OSSearchTrainAllAngles (colour_image *src, long lPlane, long* pTrainedModel, long lLeft, long lTop, long lRight, long lBottom, long lAngleIncrement, long lStartAngle, long lEndAngle, long lQuality);
VB Public Declare Function FS_OSSearchTrainAllAngles Lib "ImageFunctionsOptimisedSearch" (ByVal src As Long, ByVal lPlane As Long, ByRef pModel As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lAngleIncrement As Long, ByVal lStartAngle As Long, ByVal lEndAngle As Long) As Long
As FS_OSSearchTrain
lAngleIncrement is the interval in degrees between models
lStartAngle is the start of the angle range for training (0-360)
lEndAngle is the end of the angle range for training (0-360). It must be greater than lStartAngle
lQuality defines the speed/quality trade off, and ranges from 40 to 100





FS_OSDeleteModel

VC long _stdcall FS_OSDeleteModel (long* pTrainedModel);
VB Public Declare Function FS_OSDeleteModel Lib "ImageFunctionsOptimisedSearch" (ByRef pModel As Long) As Long
Deletes a trained model and sets the pointer to zero,



Search use functions

FS_OSCreateSearchParams

VC long _stdcall FS_OSCreateSearchParams (long* pSearchParams, long lMaxResults, long lMinScore, long lOptimumScore);
VB Public Declare Function FS_OSCreateSearchParams Lib "ImageFunctionsOptimisedSearch" (ByRef pParams As Long, ByVal lMaxResults As Long, ByVal lMinScore As Long, ByVal lOptimumScore As Long) As Long
Sets up parameters for a basic search.
pSearchParams is a pointer to the parameter structure created, which need to be deleted using FS_OSDeleteSearchParams
lMaxResults is the maximum number of results to be returned.
lMinScore is the minimum score a result needs to reach
lOptimumScore is the score at which the search moves on to look for the next result. Set it to 100 unless speed is of the essence



FS_OSCreateAngleSearchParams

VC long _stdcall FS_OSCreateAngleSearchParams (long* pSearchParams, long lMaxResults, long lMinScore, long lOptimumScore, long lStartAngle, long lEndAngle);
VB Public Declare Function FS_OSCreateAngleSearchParams Lib "ImageFunctionsOptimisedSearch" (ByRef pParams As Long, ByVal lMaxResults As Long, ByVal lMinScore As Long, ByVal lOptimumScore As Long, ByVal lStartAngle As Long, ByVal lEndAngle As Long) As Long
As above, but will search within an angle range.
The angle range must have been trainged other wise an invalid parameter error will be returned.
lStartAngle is the start of the angle range for searching (0-360).
lEndAngle is the end of the angle range for searching (0-360). It must be greater than lStartAngle



FS_OSSearchUse

VC long _stdcall FS_OSSearchUse (colour_image *src, long lPlane, long pTrainedModel, long pSearchParams, long lLeft, long lTop, long lRight, long lBottom, double *dResultX, double *dResultY, double *dScore, long *lResultCount);
VB Public Declare Function FS_OSSearchUse Lib "ImageFunctionsOptimisedSearch" (ByVal src As Long, ByVal lPlane As Long, ByVal hModel As Long, ByVal pParams As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByRef dResultX As Double, ByRef dResultY As Double, ByRef dScore As Double, ByRef lResultCount As Long) As Long
Performs a search using the parameters given.
Result data is stored within the model.
dResultX and dResultY the location of the top left corner of the best result
dScore the score of the best result.
lResultCount the number of results returned.



FS_OSDeleteSearchParams

VC long _stdcall FS_OSDeleteSearchParams (long* pSearchParams);
VB Public Declare Function FS_OSDeleteSearchParams Lib "ImageFunctionsOptimisedSearch" (ByRef pParams As Long) As Long
Deletes a set of search parameters and sets the pointer to zero.



FS_OSSearchGetResult

VC long _stdcall FS_OSSearchGetResult (long pModel, long lIndex, double *dResultX, double *dResultY, double *dScore);
VB Public Declare Function FS_OSSearchGetResult Lib "ImageFunctionsOptimisedSearch" (ByVal hModel As Long, ByVal lIndex As Long, ByRef dResultX As Double, ByRef dResultY As Double, ByRef dScore As Double) As Long
Gets the specified search result
lIndex the index of the result requested (1 based)
dResultX and dResultY the location of the top left corner of the specified result
dScore the score of the specified result.





Blob functions

FS_BlobUse

VC long _stdcall FS_BlobUse(long params, colour_image* src, long* results, long lLeft, long lTop, long lRight, long lBottom, long* lNumberOfBlobsFound);
VB Public Declare Function FS_BlobUse Lib "ImageFunctions.dll" (ByVal params As Long, ByVal src As Long, ByRef results As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByRef lNumberOfBlobsFound As Long) As Long



FS_SetBlobParams

VC long _stdcall FS_SetBlobParams(long* params, long lLowThreshold, long lHighThreshold, long lMaxNumberOfBlobs, long lMaxTotalArea, long lMinBlobArea, long lMaxBlobArea);
VB Public Declare Function FS_SetBlobParams Lib "ImageFunctions.dll" (ByRef params As Long, ByVal lLowThreshold As Long, ByVal lHighThreshold As Long, ByVal lMaxNumberOfBlobs As Long, ByVal lMaxTotalArea As Long, ByVal lMinBlobArea As Long, ByVal lMaxBlobArea As Long) As Long



FS_DeleteBlobParams

VC long _stdcall FS_DeleteBlobParams(long* params);
VB Public Declare Function FS_DeleteBlobParams Lib "ImageFunctions.dll" (ByRef params As Long) As Long



FS_DeleteBlobResults

VC long _stdcall FS_DeleteBlobResults(long* results);
VB Public Declare Function FS_DeleteBlobResults Lib "ImageFunctions.dll" (ByRef results As Long) As Long



FS_BlobGet

VC long _stdcall FS_BlobGet(long results, long lIndex, long* pBlob);
VB Public Declare Function FS_BlobGet Lib "ImageFunctions.dll" (ByVal results As Long, ByVal lIndex As Long, ByRef pBlob As Long) As Long



FS_BlobArea

VC long _stdcall FS_BlobArea(long pBlob);
VB Public Declare Function FS_BlobArea Lib "ImageFunctions.dll" (ByVal pBlob As Long) As Long



FS_BlobCentreX

VC double _stdcall FS_BlobCentreX(long pBlob);
VB Public Declare Function FS_BlobCentreX Lib "ImageFunctions.dll" (ByVal pBlob As Long) As Double



FS_BlobCentreY

VC double _stdcall FS_BlobCentreY(long pBlob);
VB Public Declare Function FS_BlobCentreY Lib "ImageFunctions.dll" (ByVal pBlob As Long) As Double



FS_BlobMinX

VC long _stdcall FS_BlobMinX(long pBlob);
VB Public Declare Function FS_BlobMinX Lib "ImageFunctions.dll" (ByVal pBlob As Long) As Long



FS_BlobMinY

VC long _stdcall FS_BlobMinY(long pBlob);
VB Public Declare Function FS_BlobMinY Lib "ImageFunctions.dll" (ByVal pBlob As Long) As Long



FS_BlobMaxX

VC long _stdcall FS_BlobMaxX(long pBlob);
VB Public Declare Function FS_BlobMaxX Lib "ImageFunctions.dll" (ByVal pBlob As Long) As Long



FS_BlobMaxY

VC long _stdcall FS_BlobMaxY(long pBlob);
VB Public Declare Function FS_BlobMaxY Lib "ImageFunctions.dll" (ByVal pBlob As Long) As Long



FS_BlobBasicInfo

VC long _stdcall FS_BlobBasicInfo(long pBlob, long* lArea, double* dCentreX, double* dCentreY);
VB Public Declare Function FS_BlobBasicInfo Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByRef lArea As Long, ByRef dCentreX As Double, ByRef dCentreY As Double) As Long



FS_BlobPaint

VC long _stdcall FS_BlobPaint(long pBlob, colour_image* dest, long lLeft, long lTop);
VB Public Declare Function FS_BlobPaint Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByVal hImage As Long, ByVal lLeft As Long, ByVal lTop As Long) As Long



FS_BlobPerimeterLength

VC long _stdcall FS_BlobPerimeterLength(long pBlob, long* pLength);
VB Public Declare Function FS_BlobPerimeterLength Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByRef lLength As Long) As Long



FS_BlobPerimeterPoint

VC long _stdcall FS_BlobPerimeterPoint(long pBlob, long lIndex, long* plPointX, long* plPointY);
VB Public Declare Function FS_BlobPerimeterPoint Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByVal lIndex As Long, ByRef lPointX As Long, ByRef lPointY As Long) As Long



FS_BlobLargest

VC long _stdcall FS_BlobMaxDiameter(long pBlob, long* pDiameter);
VB Public Declare Function FS_BlobLargest Lib "ImageFunctions.dll" (ByVal results As Long, ByRef pLargestBlob As Long) As Long



FS_BlobRoundness

VC long _stdcall FS_BlobRoundness(long pBlob, double* pdRoundness);
VB Public Declare Function FS_BlobRoundness Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByRef dRoundness As Double) As Long



FS_BlobNext

VC long _stdcall FS_BlobNext(long lBlob, long* pNext);
VB Public Declare Function FS_BlobNext Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByRef pNextBlob As Long) As Long



FS_BlobHoleArea

VC long _stdcall FS_BlobHoleArea(long lBlob, long* lHoleArea);
VB Public Declare Function FS_BlobHoleArea Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByRef lHoleArea As Long) As Long



FS_BlobAngle

VC long _stdcall FS_BlobAngle(long pBlob, double* pdAngle);
VB Public Declare Function FS_BlobAngle Lib "ImageFunctions.dll" (ByVal pBlob As Long, ByRef dAngle As Double) As Long



FS_BlobTotalArea

VC long _stdcall FS_BlobTotalArea(long results);
VB Public Declare Function FS_BlobTotalArea Lib "ImageFunctions.dll" (ByVal results As Long) As Long



Helper functions

FS_LoadImage

VC long _stdcall FS_LoadImage(char* sFileName, colour_image** pdest);
VB Public Declare Function FS_LoadImage Lib "ImageFunctions.dll" (ByVal FileName As String, ByRef Image As Long) As Long



FS_SaveImage

VC long _stdcall FS_SaveImage(colour_image* hImage, char* sFileName);
VB Public Declare Function FS_SaveImage Lib "ImageFunctions.dll" (ByVal Image As Long, ByVal FileName As String) As Long



FS_ImageAreaTohDC

VB Public Declare Function FS_ImageAreaTohDC Lib "ImageFunctions.dll" (ByVal Image As Long, ByVal hDC As Long, ByVal lLeft As Long, ByVal lTop As Long, ByVal lRight As Long, ByVal lBottom As Long, ByVal lTargetLeftPixels As Long, ByVal lTargetTopPixels As Long, ByVal lTargetWidthPixels As Long, ByVal lTargetHeightPixels As Long) As Long



FS_ImageTohDC

VC long _stdcall FS_ImageAreaTohDC(colour_image* src, HDC hDC, long lLeft, long lTop, long lRight, long lBottom, long lTargetLeftPixels, long lTargetTopPixels, long lTargetWidthPixels, long lTargetHeightPixels);
VB Public Declare Function FS_ImageTohDC Lib "ImageFunctions.dll" (ByVal Image As Long, ByVal hDC As Long, ByVal lTargetLeftPixels As Long, ByVal lTargetTopPixels As Long, ByVal lTargetWidthPixels As Long, ByVal lTargetHeightPixels As Long) As Long



FS_CheckRegistration

VC long _stdcall FS_CheckRegistration();
VB Public Declare Function FS_CheckRegistration Lib "ImageFunctions.dll" () As Long
Checks registration details and activates the library if they exist
Start in demo mode otherwise



FS_ImageToPicture

VC long _stdcall FS_ImageToPicture(colour_image* hImage, LPPICTUREDISP *pPicture);
VB Public Declare Function FS_ImageToPicture Lib "ImageFunctions.dll" (ByVal hImage As Long, ByRef aPicture As StdPicture) As Long



FS_ImageFromPicture

VC long _stdcall FSImageFromPicture(colour_image** pdest, LPPICTUREDISP pPicture)
VB Public Declare Function FS_ImageFromPicture Lib "ImageFunctions.dll" (ByRef hImage As Long, ByVal aPicture As StdPicture) As Long



FS_ImageToClipboard

VC long _stdcall FS_ImageToClipboard(colour_image* hImage, HWND hWnd);
VB Public Declare Function FS_ImageToClipboard Lib "ImageFunctions.dll" (ByVal hImage As Long, ByVal hWnd As Long) As Long
Sadly this results in a 24bit image even for a monochrome source



FS_ResetTimeMicroSeconds

VC long _stdcall FS_ResetTimeMicroSeconds();
VB Public Declare Function FS_ResetTimeMicroSeconds Lib "ImageFunctions.dll" () As Long
Resets the internal timer



FS_GetTimeMicroSeconds

VC double _stdcall FS_GetTimeMicroSeconds();
VB Public Declare Function FS_GetTimeMicroSeconds Lib "ImageFunctions.dll" () As Double
Reads the internal timer - value is to microsecond accuracy, but is actually in seconds



FS_SetHandleProtection

VC void _stdcall FS_SetHandleProtection(long lProtectionOn);
VB Public Declare Sub FS_SetHandleProtection Lib "ImageFunctions.dll" (ByVal lProtectionOn As Long)
Turns handle protection functionality on/off, the default is on. In this case an invalid image handle will raise a pointer error.



Utility functions

FS_ArcCos

VC double _stdcall FS_ArcCos (double dValue);
VB Public Declare Function FS_ArcCos Lib "ImageFunctions.dll" (ByVal dValue As Double) As Double



FS_ArcSin

VC double _stdcall FS_ArcSin (double dValue);
VB Public Declare Function FS_ArcSin Lib "ImageFunctions.dll" (ByVal dValue As Double) As Double



FS_RadiansToDegrees

VC double _stdcall FS_RadiansToDegrees (double dValue);
VB Public Declare Function FS_RadiansToDegrees Lib "ImageFunctions.dll" (ByVal dValue As Double) As Double



FS_DegreesToRadians

VC double _stdcall FS_DegreesToRadians (double dValue);
VB Public Declare Function FS_DegreesToRadians Lib "ImageFunctions.dll" (ByVal dValue As Double) As Double



FS_AngleFromPoint

VC double _stdcall FS_AngleFromPoint (long lPointX, long lPointY);
VB Public Declare Function FS_AngleFromPoint Lib "ImageFunctions.dll" (ByVal lPointX As Long, ByVal lPointY As Long) As Double
In the range 0-360, measured clockwise from the 3 oclock position.